package demo3;

public class OldCryptoServiceImpl implements OldCryptoService {
    @Override
    public String encryptOld(String plainText, String key) {
        // 模拟旧加密逻辑（简单异或，仅作演示）
        char[] textChars = plainText.toCharArray();
        char[] keyChars = key.toCharArray();
        for (int i = 0; i < textChars.length; i++) {
            textChars[i] ^= keyChars[i % keyChars.length];
        }
        System.out.println("旧加密完成（性能差）");
        return new String(textChars);
    }

    @Override
    public String decryptOld(String cipherText, String key) {
        // 旧解密逻辑（与加密逻辑一致，异或可逆）
        return encryptOld(cipherText, key);
    }
}